//if you are reading this you are using my lightsaber for some reason.
//
// XcoliahX was the original author, i just modified/removed the code to work with my gametype (no force)



if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "Axe"			
	SWEP.Author				= "Mr Fix It"
	SWEP.Slot				= 0
	SWEP.SlotPos			= 1
	SWEP.IconLetter			= "f"
	SWEP.DrawCrosshair		= false
	
        killicon.AddFont( "weapon_knife", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )


end

-----------------------Main functions----------------------------
 
-- function SWEP:Reload() --To do when reloading
-- end 
 
function SWEP:JumpReset()
end

function SWEP:Think()

	
end

function SWEP:Initialize()
util.PrecacheSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav")
util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav")
if (SERVER) then
	self:SetWeaponHoldType("melee") 
end
end
 
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + 2)

local trace = self.Owner:GetEyeTrace()

if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
	bullet = {}
	bullet.Num    = 1
	bullet.Src    = self.Owner:GetShootPos()
	bullet.Dir    = self.Owner:GetAimVector()
	bullet.Spread = Vector(0, 0, 0)
	bullet.Tracer = 0
	bullet.Force  = 0
	bullet.Damage = 10
self.Owner:FireBullets(bullet)

if(SERVER && trace.Entity:GetName()=="tree_minable") then
	if(self.Owner.inventory.wood==nil) then
		self.Owner.inventory.wood=0
	end
	self.Owner.inventory.wood=self.Owner.inventory.wood+1
	self.Owner:ChatNotify("You Chopped 1 wood")
end
end
self.Weapon:EmitSound("weapons/iceaxe/iceaxe_swing1.wav")

self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
self.Owner:SetAnimation( PLAYER_ATTACK1 )

end


-------------------------------------------------------------------

------------General Swep Info---------------
SWEP.Author   = "Mr Fix It"
SWEP.Contact        = ""
SWEP.Purpose        = ""
SWEP.Instructions   = ""
SWEP.Spawnable      = false
SWEP.AdminSpawnable  = true
-----------------------------------------------

------------Models---------------------------
SWEP.ViewModel      = "models/weapons/v_fireaxe.mdl"
SWEP.WorldModel   = "models/weapons/w_fireaxe.mdl"
-----------------------------------------------
SWEP.Name="axe"
-------------Primary Fire Attributes----------------------------------------
SWEP.Primary.Delay			= 5	--In seconds
SWEP.Primary.Recoil			= 0		--Gun Kick
SWEP.Primary.Damage			= 50	--Damage per Bullet
SWEP.Primary.NumShots		= 1		--Number of shots per one fire
SWEP.Primary.Cone			= 0 	--Bullet Spread
SWEP.Primary.ClipSize		= -1	--Use "-1 if there are no clips"
SWEP.Primary.DefaultClip	= -1	--Number of shots in next clip
SWEP.Primary.Automatic   	= true	--Pistol fire (false) or SMG fire (true)
SWEP.Primary.Ammo         	= "none"	--Ammo Type
-------------End Primary Fire Attributes------------------------------------
 
-------------Secondary Fire Attributes-------------------------------------
SWEP.Secondary.Delay		= 120
SWEP.Secondary.Recoil		= 0
SWEP.Secondary.Damage		= 0
SWEP.Secondary.NumShots		= 1
SWEP.Secondary.Cone			= 0
SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic   	= true
SWEP.Secondary.Ammo         = "none"
-------------End Secondary Fire Attributes--------------------------------
function SWEP:Deploy()
	self.Weapon:EmitSound( "weapons/knife/knife_deploy1.wav" ) --Plays a nifty sound when you pull it out.
end
